﻿@using System.Web.Script.Serialization
@{
    ViewBag.Title = "StatusTaged";
}


<div class="container">


    <div class="statuses_list" data-bind="visible:Messages().length>0" style="display: none">

        <ul class="media-list">
            <!-- ko foreach: Messages-->
            <li class="media">
                <a class="pull-left" href="#">
                    <img data-bind="attr:{src: CustomerLogoUrl}" class="media-object" />
                </a>
                <div class="media-body ">
                    <h4 class="media-heading"></h4>

                    <div class="comment-content" style="float: left" data-bind="attr:{link:'/status/' +Id()},click:GoOnePageProduct">
                        <span data-bind="html:Text"></span>
                        <!-- ko if: IsProduct-->
                        <div>
                            <span data-bind="text:ProductStock"></span>
                            <span data-bind="text:ProductPrice"></span>
                        </div>
                        <!-- /ko -->

                        <!-- ko foreach: Pics-->
                        <div class="comment-pictures">
                            <img data-bind="attr:{src: PicUrl},click:ShowOriginalPic" />
                        </div>
                        <!-- /ko -->

                        <ul class="status-tagedit-list " style="border: 0px">
                            <!-- ko foreach: Tags-->
                            <li class="tagedit-listelement tagedit-listelement-old"><span data-bind="text:TagName"></span></li>
                            <!-- /ko -->
                        </ul>

                    </div>
                    <div class="operation">
                    </div>
                </div>
            </li>

            <!-- /ko -->
        </ul>

        @*<div class="row-fluid">
        <input type="button" value="More" data-bind="click:MoreStatus,visible:Messages().length>0" class="btn btn-default btn-block" />
    </div>*@
    </div>
</div>


@{
    var model = ViewBag.Model;
    var jsonStr = new HtmlString(new JavaScriptSerializer().Serialize(model));
}

@section scripts
{
    <script src="~/Scripts/posts/posts.js"></script>
    <script src="~/Scripts/posts/tags.js"></script>

    <script>

        var init = @jsonStr;


        function PostTaggedModel() {
            
            var self = this;
            var tempMessages = $.isEmptyObject(init.PostList) ? [] : $.map(init.PostList, function(a) {
               
                return BuildListItemModel(a);
            });
        
            self.Messages = ko.observableArray(tempMessages);
        }

        var vm = new PostTaggedModel();
        ko.applyBindings(vm);
    </script>
}